<include file="public@header"/>
</head>
<body>
    <div class="layui-fluid">
        <form action="{:url('AdminMeeting/editPost')}" method="post" class="layui-form js-ajax-form">
            <div class="layui-card">
                <div class="layui-card-header">编辑会议室</div>
                <div class="layui-card-body">
                    <!-- 列表标题 -->
                    <div class="layui-form-item">
                        <label class="layui-form-label">会议列表标题</label>
                        <div class="layui-input-block">
                            <input class="layui-input form-replace" type="text" name="post[list_title]" data-field="list_title"
                                    placeholder="{:lang('PLEASE_ENTER')}会议列表标题" value="{$result.list_title}"/>
                        </div>
                    </div>
                    <!-- 列表副标题 -->
                    <div class="layui-form-item">
                        <label class="layui-form-label">会议列表副标题</label>
                        <div class="layui-input-block">
                            <input class="layui-input form-replace" type="text" name="post[list_subtitle]" data-field=list_subtitle"
                                    placeholder="{:lang('PLEASE_ENTER')}会议列表副标题" value="{$result.list_subtitle}"/>
                        </div>
                    </div>
                    <!-- 内容标题 -->
                    <!-- <div class="layui-form-item">
                        <label class="layui-form-label">会议详情标题</label>
                        <div class="layui-input-block">
                            <input class="layui-input form-replace" type="text" name="post[title]" data-field="title"
                                    placeholder="{:lang('PLEASE_ENTER')}会议详情标题" value="{$result.title}" />
                        </div>
                    </div> -->
                    <!-- 简介 -->
                    <div class="layui-form-item">
                        <label class="layui-form-label">会议室简介</label>
                        <div class="layui-input-block">
                            <textarea type="text" class="layui-textarea" id="input-remark" name="post[intro]">{$result['intro']}</textarea>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">是否需要预定时选择会议类型</label>
                        <div class="layui-input-block">
                            <select class="layui-input" name="post[is_type]">
                                <option value='0' <if condition="$result['is_type'] eq 0">selected</if>>不需要选择</option>
                                <option value='1' <if condition="$result['is_type'] eq 1">selected</if>>需要选择</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">是否需要预定时选择主席台布置</label>
                        <div class="layui-input-block">
                            <select class="layui-input" name="post[is_layout]">
                                <option value='0' <if condition="$result['is_layout'] eq 0">selected</if>>不需要选择</option>
                                <option value='1' <if condition="$result['is_layout'] eq 1">selected</if>>需要选择</option>
                            </select>
                        </div>
                    </div>
                    <!-- 对外价格 -->
                    <div class="layui-form-item">
                        <label class="layui-form-label">对外价格</label>
                        <div class="layui-input-block">
                            <input class="layui-input form-replace" type="text" name="post[out_price]" data-field="out_price"
                                    placeholder="{:lang('PLEASE_ENTER')}对外价格" value="{$result['out_price']}" />
                        </div>
                    </div>
                    <!-- 对内价格 -->
                    <div class="layui-form-item">
                        <label class="layui-form-label">对内价格</label>
                        <div class="layui-input-block">
                            <input class="layui-input form-replace" type="text" name="post[in_price]" data-field="in_price"
                                    placeholder="{:lang('PLEASE_ENTER')}对内价格" value="{$result['in_price']}"/>
                        </div>
                    </div>  
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <input type="hidden" name="post[id]" value="{$result.id}">
                            <button type="submit" class="layui-btn layui-btn-normal js-ajax-submit">{:lang('SAVE')}</button>
                            <a class="layui-btn layui-btn-primary" href="{:url('AdminMeeting/index')}">{:lang('BACK')}</a>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>

<include file="public@footer"/>
<include file="admin@theme/scripts"/>
<script type="text/javascript">
    //编辑器路径定义
    var editorURL = GV.WEB_ROOT;
</script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.js"></script>
<script type="text/javascript">
    $(function () {
        if( $('#detail_content').length ){
            // $('.content-preview').show();
            UE.getEditor('detail_content');
        }
        if( $('#post_excerpt').length ){
            UE.getEditor('post_excerpt');
        }
        //移除缩略图
        $('.btn-cancel-thumbnail').click(function () {
            $('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
            $('#thumbnail').val('');
        });

    });

    // 选择分类
    function doSelectCategory() {
        var selectedCategoriesId = $('#js-categories-id-input').val();
        openIframeLayer("{:url('AdminCategory/select')}?operate=add&ids=" + selectedCategoriesId, '请选择分类', {
            area: ['700px', '400px'],
            btn: ['确定', '取消'],
            yes: function (index, layero) {
                //do something

                var iframeWin          = window[layero.find('iframe')[0]['name']];
                var selectedCategories = iframeWin.confirm();
                if (selectedCategories.selectedCategoriesId.length == 0) {
                    layer.msg('请选择分类');
                    return;
                }
                $('#js-categories-id-input').val(selectedCategories.selectedCategoriesId.join(','));
                $('#js-categories-name-input').val(selectedCategories.selectedCategoriesName.join(' '));
                //console.log(layer.getFrameIndex(index));
                layer.close(index); //如果设定了yes回调，需进行手工关闭
            }
        });
    }
</script>
